package com.neutech.controller;

import com.neutech.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
public class DoctorController {
//    @Autowired
//    private MenuService menuService;
    /*******************医生___START*************************/
    @Autowired
    private DoctorService doctorService;
    @RequestMapping("/queryDoctor")
    public List<Map<String,Object>> getDoctor(){
        return doctorService.queryDoctor();
    }
    @RequestMapping("/insertDoctor")
    public void insDoctor(@RequestParam Map  map){
        doctorService.insertDoctor(map);
        System.out.println(map.get("docid"));
    }
    @RequestMapping("/deleteDoctor")
    public void delDoctor(@RequestParam Map  map){
        doctorService.deleteDoctor(map);
        System.out.println(map.get("docid"));
    }
    @RequestMapping("/updataDoctor")
    public void updDoctor(@RequestParam Map  map){
//        System.out.println("看这里");
//        System.out.println(map);
//        System.out.println("看这里");
        Map<String,Object> map2 = new HashMap<>();
        map2.put("docid",map.get("docid"));
        map2.put("name",map.get("name"));
        map2.put("depid",map.get("depid"));
        map2.put("account",map.get("account"));
        map2.put("password",map.get("password"));
        map2.put("level",map.get("level"));
        map2.put("quota",map.get("quota"));
        map2.put("fees",map.get("fees"));
        doctorService.updataDoctor(map2);
    }
    /**************************END*******************************/

}
